package com.fc.entity;

import cn.hutool.core.convert.impl.StringConverter;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.converters.localdatetime.LocalDateTimeDateConverter;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "logistics", autoResultMap = true)
public class Logistics implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private Long driverId;
    private Long routeId;
    private Long regionId;
    private String vehiclePlate;
    private String pickupLocation;
    private String deliveryLocation;
    private Integer cargoType;
    private Integer transportType;
    private LocalDateTime departureTime;
    private LocalDateTime arrivalTime;
    private Integer status;
    private BigDecimal rate;
    private BigDecimal price;
    private BigDecimal coefficient;
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> evidenceImages;
    public BigDecimal getLogisticsIncome() {
        return rate == null ? BigDecimal.ZERO : rate.multiply(coefficient == null ? BigDecimal.ONE : coefficient);
    }
}